package users.vladan.app;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import users.vladan.beans.Config;

public class MainApp {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		final AbstractApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "users/vladan/main.spring.xml" });
		context.registerShutdownHook();
		context.containsBean("config");
		Config config = context.getBean("config", Config.class);
		System.out.println ("Config.CustomerSize: "+config.getMaxCacheSize());
		System.out.println ("Config.DateFormat: "+config.getDateFormat());
		System.out.println ("Config.DatabaseParams: "+config.getDatabaseParams().getParameters());
		System.out.println ("Config.JavaHome: "+config.getJavaHome());
		
		
		config.setMaxCacheSize(9999);
		
		Config anotherConfig = context.getBean("config", Config.class);

		System.out.println ("anotherConfig.CustomerSize: "+anotherConfig.getMaxCacheSize());
	}

}
